package com.wd.jetpack.api.network


import com.wd.jetpack.BuildConfig
import okhttp3.CookieJar
import okhttp3.Interceptor
import okhttp3.OkHttpClient


/**
 * 页面描述：BaseNetProvider
 *
 *
 * Created by ditclear on 2017/7/28.
 */

open class BaseNetProvider : NetProvider {
    override fun configInterceptors(): Array<Interceptor>? {
        return arrayOf(LogInterceptor())
    }

    override fun configHttps(builder: OkHttpClient.Builder) {

    }

    override fun configCookie(): CookieJar? = null

    override fun configHandler(): RequestHandler {
        return BaseHeaderHandler()
    }

    override fun configConnectTimeoutSecs(): Long {
        return CONNECT_TIME_OUT
    }

    override fun configReadTimeoutSecs(): Long {
        return READ_TIME_OUT
    }

    override fun configWriteTimeoutSecs(): Long {
        return WRITE_TIME_OUT
    }

    override fun configLogEnable(): Boolean {
        return BuildConfig.DEBUG
    }

    companion object {
        const val CONNECT_TIME_OUT: Long = 10
        const val READ_TIME_OUT: Long = 30
        const val WRITE_TIME_OUT: Long = 40
    }
}
